<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>核对订单</title>
<link href="${ctx }/style/common.css" rel="stylesheet" type="text/css" />
<style type="text/css">
#main{margin: 0 auto;width: 960px;background-color: #ffffff;min-height: 450px;border: 1px solid #ccc;margin-top: 5px;}
#dglc{margin: 0 auto;width: 830px;padding: 35px 0px 30px 0px;}
#ddhd{margin: 0 auto;width: 830px;font-size: 22px;color:#fd7602;padding:0px 0px 20px 0px;font-family:黑体 }
#tableDiv{margin: 0 auto;width: 830px;}
.goods_detail_table{font-size: 12px;}
.goods_detail_table td{text-align: center;}

#order_confirm_bottom{margin: 0 auto;width: 830px;margin-top: 20px;}
.fpItem{width: 80px;font-size: 12px;color: #c0c0c0;line-height: 30px;text-align: right;}
.fpContent{font-size: 12px;color: #c0c0c0;line-height: 30px;}
</style>

</head>
<body>

<%@include file="/commons/head.jsp"%>

<div id="main">
	<div id="dglc">
		<div style="float: right;"><img src="${ctx }/images/order/order_step1.png" border="0"/></div>
		<div style="float: right;padding-top: 5px;">订购流程:</div>
		<div style="clear: both;"></div>
	</div>
	<div id="ddhd">核对订单</div>
	<div id="tableDiv">
		<table cellpadding="0" cellspacing="1" border="0" bgcolor="#cccccc" align="center" width="100%" class="goods_detail_table">
			<tr bgcolor="#fffae7"><td height="30">商品编号</td><td>商品名称</td><td>单价(元)</td><td>购买数量</td><td>物流费</td><td>合计(元)</td></tr>
			<tr bgcolor="#ffffff">
				<td height="30">${requestScope.goods.sn }</td>
				<td>${requestScope.goods.name }</td>
				<td>
					<c:choose>
						<c:when test="${requestScope.goods.mktprice != null}">${requestScope.goods.mktprice}</c:when>
						<c:otherwise>${requestScope.goods.price}</c:otherwise>
					</c:choose>
				</td>
				<td>${requestScope.num }</td>
				<td>卖家承担</td>
				<td>${requestScope.totalPrice }</td>
			</tr>
		</table>
	</div>
	<div id="order_confirm_bottom">
		<div style="float: left;width: 680px;">
			<form id="order_confirm_form" name="order_confirm_form" action="${ctx }/customer/order!confirmOrder.do" method="post">
				<table border="0" cellpadding="0" cellspacing="0" width="100%">
					<tr><td class="fpItem">是否开发票：</td><td class="fpContent"><input name="fpFlag" value="1" type="radio" onclick="showFpDetail('1')"/>是<input name="fpFlag" value="0" type="radio" checked="checked" onclick="showFpDetail('0')"/>否</td></tr>
					<tr style="display: none;" id="fpTypeTr"><td class="fpItem">发票类型：</td><td class="fpContent"><input name="fpType" checked="checked" value="普通发票" type="radio"/>普通发票<input name="fpType" value="增值税发票" type="radio"/>增值税发票</td></tr>
					<tr style="display: none;" id="fpType2Tr"><td class="fpItem">发票抬头：</td><td class="fpContent"><input name="fpType2" value="个人" checked="checked" type="radio" onclick="chooseFpType('0')"/>个人<input name="fpType2" value="单位" type="radio" onclick="chooseFpType('1')"/>单位</td></tr>
					<tr style="display: none;" id="fpHeadTr"><td class="fpItem">单位名称：</td><td class="fpContent"><input name="fpHead" id="fpHead" style="width: 300px"/></td></tr>
					<tr style="display: none;" id="fpTipsTr"><td class="fpItem"></td><td class="fpContent">温馨提示：您所填写内容将全部打印至发票，请勿填写与发票抬头无关的信息</td></tr>
				</table>
				<input type="hidden" name="gId" id="gId" value="${requestScope.goods.id }"/>
				<input type="hidden" name="num" id="num" value="${requestScope.num }"/>
			</form>
		</div>
		<div style="float: right;">
			<div>应付金额：<span style="color:red ">￥${requestScope.totalPrice }元</span></div>
			<div style="margin-top: 15px;"><input type="button" onclick="submitOrder()" class="" value="提交订单" style="width: 104px;height:34px;font-size: 14px;font-weight: bold;line-height: 34px;text-align: center;cursor: pointer;text-shadow: 0px 1px 0px #E9FDE5;"/></div>
		</div>
		<div style="clear: both;"></div>
	</div>
</div>

<%@include file="/commons/foot.jsp" %>

<script  type="text/javascript">
//是否显示发票详情
function showFpDetail(flag){
	 if(flag == "1"){
		$("#fpTypeTr").show();
		$("#fpType2Tr").show();
		var fpType2 = $("input[name='fpType2']:checked").val();
		if( fpType2 == '单位'){
			$("#fpHeadTr").show();
			$("#fpTipsTr").show();
		}else{
			$("#fpHeadTr").hide();
			$("#fpTipsTr").hide();
		}
	 }
	 else{
		$("#fpTypeTr").hide();
		$("#fpType2Tr").hide();
		$("#fpHeadTr").hide();
		$("#fpTipsTr").hide();
	 }
}

//选择发票类型
function chooseFpType(flag){

	if(flag == "1"){
		$("#fpHeadTr").show();
		$("#fpTipsTr").show();
	}else{
		$("#fpHeadTr").hide();
		$("#fpTipsTr").hide();
		$("#fpHeadTr").val("");
	}
}

function submitOrder(){
	var fp_flag = $("input[name='fpFlag']:checked").val();
	var fpType2 = $("input[name='fpType2']:checked").val();
	if( fp_flag == '1' &&  fpType2 == '单位'){
		var fpHead = $("#fpHead").val();
		if(fpHead == ''){
			alert("请填写发票抬头，单位名称。");
			return false;
		}
	}
	$("#order_confirm_form").submit();
}

</script>
</body>
</html>